package com.sdp.refund.db.refund_user.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sdp.refund.db.refund_user.entity.RefundUser;
import com.sdp.refund.db.refund_user.mapper.RefundUserMapper;
import com.sdp.refund.db.refund_user.service.IRefundUserService;
import com.sdp.refund.utils.RefundConstants;
import com.sdp.refund.view.RefundUserCountView;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zsp
 * @since 2024-08-28
 */
@Service
public class RefundUserServiceImpl extends ServiceImpl<RefundUserMapper, RefundUser> implements IRefundUserService {

	@Autowired
	private RefundUserMapper refundUserMapper;
	
	
	public List<RefundUserCountView> selectRefundStateCount(){
		return refundUserMapper.selectRefundStateCount();
	}
	
	@Override
	public List<RefundUser> queryRefundUserByTelAndName(String userName, String userTel) {
		LambdaQueryWrapper<RefundUser> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(RefundUser::getUserName, userName);
		queryWrapper.eq(RefundUser::getUserTel, userTel);
		return list(queryWrapper);
	}

	@Override
	public List<RefundUser> queryRefundUserByTelAndNameAndState(String userName, String userTel,
			List<String> refundStates) {
		LambdaQueryWrapper<RefundUser> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(RefundUser::getUserName, userName);
		queryWrapper.eq(RefundUser::getUserTel, userTel);
		queryWrapper.eq(RefundUser::getDataType, RefundConstants.数据类型_退费.getCode());
		queryWrapper.in(RefundUser::getRefundState, refundStates);
		return list(queryWrapper);
	}

}
